/*
 * Copyright 2011 Clean GWT
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.cleanform.gwt.chinesechess.client.page;

import com.cleanform.gwt.chinesechess.client.activity.ChessGameView;
import com.cleanform.gwt.chinesechess.client.activity.GameHallView;
import com.cleanform.gwt.page.client.AbstractPage;
import com.cleanform.gwt.page.client.PageContext.Page;
import com.cleanform.gwt.user.client.ui.DeckPanel;
import com.cleanform.gwt.view.client.activity.ActivityManager;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.user.client.ui.Widget;

/**
 * 
 * @author Jess
 * @version 1.0
 * @since 1.0
 */
@Page
public class GameHall extends AbstractPage {

	DeckPanel deck = new DeckPanel();
	final ActivityManager manager = new ActivityManager(deck);

	public GameHall() {
		this.initWidget(deck);
		deck.add((Widget) GWT.create(GameHallView.class));
		deck.add((Widget) GWT.create(ChessGameView.class));

//		manager.addActiveHandler(new ActiveHandler() {
//
//			@Override
//			public void onActive(ActiveEvent event) {
////				// exit
////				if (event.getRelatedIndex() == 0) {
////					GameHallView gameHall = manager.getActivity(0);
////					gameHall.exit();
////				} else if (event.getRelatedIndex() == 1) {
////					ChessGameView chessGame = manager.getActivity(1);
////					chessGame.exit();
////				}
//
//				// enter
//				if (event.getIndex() == 0) {
//					//GameHallView gameHall = manager.getActivity(0);
//					//gameHall.enter();
//				}else if (event.getIndex() == 1) {
//					GameHallView gameHall = manager.getActivity(0);
//					ChessGameView chessGame = manager.getActivity(1);
//					chessGame.enter(gameHall.getGameToEnter());
//				}
//			}
//		});
		deck.addStyleName("container");
		manager.setActive(0);

	}

}
